const deptList = [
  { label: '一组', value: 1 },
  { label: '二组', value: 2 },
  { label: '三组', value: 3 },
  { label: '四组', value: 4 },
  { label: '电工组', value: 5 }
]
export const statusEnums = {
  1: '在职',
  2: '离职'
}
export const statusList = [
  { label: '在职', value: 1 },
  { label: '离职', value: 2 }
]
export const postList = [
  { label: '小工', value: 1 },
  { label: '中工', value: 2 },
  { label: '大工', value: 3 },
  { label: '电工', value: 4 }
]
export const roleList = [
  { label: '员工', value: 1 },
  { label: '组长', value: 2 }
]
export const sexList = [
  { label: '男', value: 1 },
  { label: '女', value: 2 }
]

/** 表单 */
export const formData = {
  name: '',
  phone: '',
  dept: '',
  daterange: ''
}
export const formConfig = [
  {
    type: 'input',
    prop: 'name',
    label: '姓名',
    clearable: true
  },
  {
    type: 'input',
    prop: 'phone',
    label: '手机号码',
    clearable: true,
    formatter: (value) => value.replace(/[^\d]/g, '')
  },
  {
    type: 'select',
    prop: 'dept',
    label: '分组',
    clearable: true,
    options: deptList
  },
  {
    type: 'select',
    prop: 'select',
    label: '用户状态',
    clearable: true,
    isEnum: true,
    options: statusEnums
  }
]
/** 表格 */
export const tableColumns = [
  {
    label: '姓名',
    prop: 'name'
  },
  {
    label: '性别',
    prop: 'sex',
    filter: (val) => {
      const cur = sexList.find((item) => item.value === val)
      return cur?.label
    }
  },
  {

  },
  {
    label: '手机号码',
    prop: 'phone'
  },
  {
    label: '岗位',
    prop: 'post',
    filter: (val) => {
      const cur = postList.find((item) => item.value === val)
      return cur?.label
    }
  },
  {
    label: '日薪',
    prop: 'dailyWage'
  },
  {
    label: '角色',
    prop: 'role',
    filter: (val) => {
      const cur = roleList.find((item) => item.value === val)
      return cur?.label
    }
  },
  {
    label: '分组',
    prop: 'dept'
  },
  {
    label: '用户状态',
    prop: 'status',
    slotName: 'status'
  },
  {
    label: '创建时间',
    prop: 'createTime'
  },
  {
    label: '操作',
    prop: 'operation',
    slotName: 'operation'
  }
]

/** 新增 编辑 */
export const aFormData = {
  name: '',
  phone: '',
  sex: 1,
  post: 1,
  dailyWage: 360,
  role: 1,
  dept: '',
  status: 1
}
export const aFormConfig = [
  {
    type: 'input',
    prop: 'name',
    label: '姓名',
    span: 12,
    clearable: true
  },
  {
    type: 'input',
    prop: 'phone',
    label: '手机号码',
    span: 12,
    clearable: true,
    formatter: (value) => value.replace(/[^\d]/g, '')
  },
  {
    type: 'radio',
    prop: 'sex',
    label: '性别',
    span: 12,
    options: [
      { label: '男', value: 1 },
      { label: '女', value: 2 }
    ]
  },
  {
    type: 'select',
    prop: 'post',
    label: '岗位',
    span: 12,
    clearable: true,
    options: postList
  },
  {
    type: 'input',
    kind: 'number',
    prop: 'dailyWage',
    label: '日薪',
    span: 12,
    clearable: true,
    options: postList
  },
  {
    type: 'select',
    prop: 'role',
    label: '角色',
    span: 12,
    clearable: true,
    options: roleList
  },
  {
    type: 'select',
    prop: 'dept',
    label: '分组',
    span: 12,
    clearable: true,
    options: deptList
  },
  {
    type: 'radio',
    prop: 'status',
    label: '用户状态',
    span: 12,
    options: statusList
  }
]
export const aFormRules = {
  name: [{ required: true, message: '请输入姓名', trigger: 'blur' }],
  phone: [{ required: true, message: '请输入手机号码', trigger: 'blur' }],
  sex: [{ required: true, message: '请选择性别', trigger: 'change' }],
  post: [{ required: true, message: '请选择分组', trigger: 'change' }],
  dailyWage: [{ required: true, message: '请输入日薪', trigger: 'blur' }],
  role: [{ required: true, message: '请选择角色', trigger: 'change' }],
  status: [{ required: true, message: '请选择用户状态', trigger: 'change' }]
}
